package weixin02.controller;

import com.alibaba.druid.support.json.JSONParser;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.spring.web.json.Json;
import weixin02.entity.User;
import weixin02.service.UserService;
import org.springframework.web.bind.annotation.*;
import weixin02.util.CommonUtil;
import weixin02.util.HttpClientUtil;
import weixin02.util.R;

import javax.annotation.Resource;

/**
 * (User)表控制层
 * @author makejava
 * @since 2021-07-06 21:14:24
 */
@Api(tags = "微信用户接口")
@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    //微信登录
    @ApiOperation(value = "微信登录",notes = "服务器发送请求，微信返回用户信息openid给服务器,保存到数据库")
    @GetMapping("userLogin")
    public R userLogin(String code,String nickName,int gender,String avatarUrl,String country,String province,String city){
        return userService.userLogin(code,nickName,gender,avatarUrl,country,province,city);
    }

}
